package com.example.demo_mysql_mybatisplus.util.api.configTab;

import com.example.demo_mysql_mybatisplus.util.api.configTab.demo.DemoTable1;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("config/tab/api")
public class TestConfigApiController {

    @GetMapping("demo_1")
    public void query0(){
        DemoTable1 ss = new DemoTable1();
        ss = ConfigApi.of(DemoTable1.class).save(ss);

        ss = ConfigApi.of(DemoTable1.class).update(ss);

        ss = ConfigApi.of(DemoTable1.class).update(ss);

        ss = ConfigApi.of(DemoTable1.class).getCurrentByParentId(ss.getParentId());



        List<DemoTable1> oo = ConfigApi.of(DemoTable1.class).getAllCurrents();

        oo = ConfigApi.of(DemoTable1.class).getHistorysByParentId(ss.getParentId());

        oo = ConfigApi.of(DemoTable1.class).getAllByParentId(ss.getParentId());



        DemoTable1 tt = (DemoTable1) ConfigApi.of(DemoTable1.class).getMapper().selectById(1);

        oo =  ConfigApi.of(DemoTable1.class).getMapper().selectList(null);


        System.out.println();
    }

}
